extends Node2D
@onready var character = $"../../Character"
var is_slide = 0
var pos_delta = 0
func _process(delta):
	var viewport_size_x = get_viewport().size.x
	if GR.screen_position.x<=position.x and position.x<=GR.screen_position.x+viewport_size_x:
		show()
	else:
		hide()
	if is_slide == 1:
		character.position.x = position.x + pos_delta
func _on_area_2d_body_entered(body):
	pos_delta = character.position.x-position.x#计算第一次落在叶子上的位置与叶子位置之差
	is_slide = 1
func _on_area_2d_body_exited(body):
	is_slide = 0
